Made debugging available globally, without a need to require in every namespace#6
Made debugging available globally, without a need to require in every namespace#6alesya-h wants to merge 1 commit intogfredericks:masterfrom
Conversation
|
This looks useful, but I don't think a library should force this on the user. I personally solve this problem by using lein-shorthand (not just for debug-repl, but for all sorts of other utilities I want globally accessible as well), but you could also put something similar to the code in this PR in your If you think it would help, I wouldn't mind a section of the README that shows users how to do that. |
|
For data, I solve this in a curious way in combination with vim. I have a custom command This then has the namespace loaded. Then I have abbreviations like |
|
now I'm curious what the |
|
You may recall writing a ring thing a while back for someone, that was me.
I have been meaning to contribute it back sometime soon.
…On March 28, 2018 10:46:16 PM GMT+01:00, Gary Fredericks ***@***.***> wrote:
now I'm curious what the `.http-intercept` namespace is, since it's not
part of `debug-repl` :)
--
You are receiving this because you commented.
Reply to this email directly or view it on GitHub:
#6 (comment)
--
Sent from my Android device with K-9 Mail. Please excuse my brevity.
|
|
I don't! It sounds interesting 😄 |
|
https://github.com/gfredericks/debug-repl/tree/http-intercept here it is. I still actively use this. (anything I have on top is pushed up: https://github.com/SevereOverfl0w/debug-repl/tree/http-intercept) |
|
wow; that's an amazing amount of code for me to have no memory of writing |
|
Personally I solve this problem via ~/.lein/profiles.clj: Requiring the namespace just once suffices to have the code loaded in any user namespace - whether it had a Then I use snippets, just like @SevereOverfl0w:
|
It is really inconvenient having to require com.gfredericks.debug-repl in every namespace while you debugging, especially given usually one has debug-repl in their user profile, not in a project definition, so having that
requires permanently in every namespace in most cases won't work.This patch adds
break!,unbreak!,unbreak!!andcatch-break!to clojure.core before nrepl middleware is installed.I chose immediate global installation rather then on-demand global installation because functions/macros will be available only to namespaces that are defined afterward unless those namespaces are manually reloaded (or unless you call
(use 'clojure.core :reload)when in that namespace).It doesn't modify any existing functions in clojure.core, only adds new ones, so it should be safe. Given debug-repl is a development tool I think it's ok to tinker with internals a little when it will lead to better development experience.